package com.mode.adapter.iterator;


/**
 * @Description:
 * @Author: zyf
 * @Time: 2020/9/29 10:45
 */
public class ConcreteIterator implements Iterator{
    private List list =null;
    private int index;

    public ConcreteIterator(List list) {
        this.list = list;

    }

    @Override
    public boolean hasNext() {
        if(index >=list.getSize()){
            return false;
        }else {
            return true;
        }

    }

    @Override
    public Object next() {
        Object o = list.get(index);
        index++;
        return o;

    }
}
